package com.i8office.android.zhihuixinwu.adapter;

import android.content.Context;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.RadioButton;
import android.widget.TextView;

import com.cyan.tools.base.BaseViewHolder;
import com.cyan.tools.base.RecyclerArrayAdapter;
import com.i8office.android.zhihuixinwu.R;
import com.i8office.android.zhihuixinwu.bean.People;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by pc on 2018/7/8.
 */

public class HandlerAdapter extends RecyclerArrayAdapter<People> {
    private int multiHandleMode;
    private People people;
    private ArrayList handlers;
    public HandlerAdapter(Context context,int multiHandleMode) {
        super(context);
        this.multiHandleMode=multiHandleMode;
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new ViewHolder(parent);
    }

    class ViewHolder extends BaseViewHolder<People> {
        @BindView(R.id.checkBox)
        CheckBox checkBox;
        @BindView(R.id.radioButton)
        RadioButton radioButton;
        @BindView(R.id.name)
        TextView name;

        public ViewHolder(ViewGroup parent) {
            super(parent, R.layout.item_handler);
            ButterKnife.bind(this,itemView);
        }

        @Override
        public void setData(People data) {
            if(multiHandleMode==1)
                checkBox.setVisibility(View.VISIBLE);
            else if(multiHandleMode==0)
                radioButton.setVisibility(View.VISIBLE);
            name.setText(data.getEmplName());
        }
    }

}
